<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This file documents the use of the GNU compilers.

Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Bug Criteria (Using the GNU Compiler Collection (GCC))</title>

<meta name="description" content="Bug Criteria (Using the GNU Compiler Collection (GCC))">
<meta name="keywords" content="Bug Criteria (Using the GNU Compiler Collection (GCC))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Indices.html" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Bugs.html" rel="up" title="Bugs">
<link href="Bug-Reporting.html" rel="next" title="Bug Reporting">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
kbd.key {font-style: normal}
span:hover a.copiable-link {visibility: visible}
ul.mark-bullet {list-style-type: disc}
-->
</style>


</head>

<body lang="en_US">
<div class="section-level-extent" id="Bug-Criteria">
<div class="nav-panel">
<p>
Next: <a href="Bug-Reporting.html" accesskey="n" rel="next">How and Where to Report Bugs</a>, Up: <a href="Bugs.html" accesskey="u" rel="up">Reporting Bugs</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Have-You-Found-a-Bug_003f"><span>15.1 Have You Found a Bug?<a class="copiable-link" href="#Have-You-Found-a-Bug_003f"> &para;</a></span></h3>
<a class="index-entry-id" id="index-bug-criteria"></a>

<p>If you are not sure whether you have found a bug, here are some guidelines:
</p>
<ul class="itemize mark-bullet">
<li><a class="index-entry-id" id="index-fatal-signal"></a>
<a class="index-entry-id" id="index-core-dump"></a>
If the compiler gets a fatal signal, for any input whatever, that is a
compiler bug.  Reliable compilers never crash.

</li><li><a class="index-entry-id" id="index-invalid-assembly-code"></a>
<a class="index-entry-id" id="index-assembly-code_002c-invalid"></a>
If the compiler produces invalid assembly code, for any input whatever
(except an <code class="code">asm</code> statement), that is a compiler bug, unless the
compiler reports errors (not just warnings) which would ordinarily
prevent the assembler from being run.

</li><li><a class="index-entry-id" id="index-undefined-behavior"></a>
<a class="index-entry-id" id="index-undefined-function-value"></a>
<a class="index-entry-id" id="index-increment-operators"></a>
If the compiler produces valid assembly code that does not correctly
execute the input source code, that is a compiler bug.

<p>However, you must double-check to make sure, because you may have a
program whose behavior is undefined, which happened by chance to give
the desired results with another C or C++ compiler.
</p>
<p>For example, in many nonoptimizing compilers, you can write &lsquo;<samp class="samp">x;</samp>&rsquo;
at the end of a function instead of &lsquo;<samp class="samp">return x;</samp>&rsquo;, with the same
results.  But the value of the function is undefined if <code class="code">return</code>
is omitted; it is not a bug when GCC produces different results.
</p>
<p>Problems often result from expressions with two increment operators,
as in <code class="code">f (*p++, *p++)</code>.  Your previous compiler might have
interpreted that expression the way you intended; GCC might
interpret it another way.  Neither compiler is wrong.  The bug is
in your code.
</p>
<p>After you have localized the error to a single source line, it should
be easy to check for these things.  If your program is correct and
well defined, you have found a compiler bug.
</p>
</li><li>If the compiler produces an error message for valid input, that is a
compiler bug.

</li><li><a class="index-entry-id" id="index-invalid-input"></a>
If the compiler does not produce an error message for invalid input,
that is a compiler bug.  However, you should note that your idea of
&ldquo;invalid input&rdquo; might be someone else&rsquo;s idea of &ldquo;an extension&rdquo; or
&ldquo;support for traditional practice&rdquo;.

</li><li>If you are an experienced user of one of the languages GCC supports, your
suggestions for improvement of GCC are welcome in any case.
</li></ul>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Bug-Reporting.html">How and Where to Report Bugs</a>, Up: <a href="Bugs.html">Reporting Bugs</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
